from docx import Document
from docx.shared import Cm
from docx.enum.text import WD_BREAK

document = Document()
section = document.sections[0]
section.orientation = 1  # 改为横向
# 需要手动互换高度和宽带
section.page_width, section.page_height = section.page_height, section.page_width
#section.page_width, section.page_height = Cm(20),Cm(14)

def oneItem(d,p1,p2,p3,p4):
    d.add_paragraph(" %s   %s "%(p1,p2))
    d.add_paragraph("")
    d.add_paragraph("")
    d.add_paragraph(" %s   %s "%(p3,18620672854))
    d.add_paragraph(" %s "%(p4))
    paragraph = d.add_paragraph(" ")
    paragraph.runs[-1].add_break(WD_BREAK.PAGE) 


oneItem(document,"1","2","3","4")
document.save(r"o2.docx")

